<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>010-canvas创建.html</title>
	<style>
		*{
			margin: 0;
			padding: 0;
		}
	</style>
</head>
<body>
	<canvas id="canvas"></canvas>
</body>
<script>
	//获取canvas的DOM元素
	var oCanvas = document.getElementById('canvas');
	//设置画布的宽高
	oCanvas.width = 600;
	oCanvas.height = 600;
	//获取canvas的上下文环境
	var ctx = oCanvas.getContext('2d');
	console.log(ctx);
</script>
</html>